package com.joker.microstoremanager.service;

import com.joker.microstoremanager.repository.ShopRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userDetailsService")
@Slf4j
public class MyUserDetailsService implements UserDetailsService {

    @Resource
    private ShopRepository shopRepository;

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        return shopRepository.findByUsername(s);
    }
}
